<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Cindy
 * @since Cindy 1.0
 */

get_header(); ?>	

<div id="featured">
<?php include (TEMPLATEPATH . '/includes/slider.php'); ?>
</div>

<div id="recent-comments">

<div class="title">Recent Comments</div>
  <ul class="recentcomm">
            <?php
              $comments = get_comments('number=5&status=approve');
              //$true_comment_count = 0;
              foreach($comments as $comment):
               $comment_type = get_comment_type();
                //if($comment_type == 'comment'):
                //$true_comment_count = $true_comment_count+1;
                //$comm_title = get_the_title($comment->comment_post_ID);
                $comm_content = get_comment($comment->comment_ID, ARRAY_A); ?>
                <li>
				 <div class="singlecomm">
				<a title="<?php printf(__("Posted in: %s", "Cindy"), get_the_title($comment->comment_post_ID)); ?>" class="fadeThis" href="<?php echo get_comment_link($comment->comment_ID) ?>">
				<div class="avatar"><?php echo get_avatar($comment->comment_author_email, 32); ?></div>
				<div class="author"><?php echo($comment->comment_author)?></div>
				 <div class="commdetail">
				<?php echo convert_smilies(cut_str($comm_content['comment_content'],23)); ?>
				
				 
				</div>
				</a>
			 </div>
				</li>
               <?php
                //endif;
                //if($true_comment_count == $commentnumber) break;
              endforeach; ?>
	</ul>

</div>
	<!-- end: menu -->
	





			<div id="content" role="main">



			<?php  if (have_posts()):
                   while (have_posts()):
                      the_post(); ?>

				<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
				
					<h2 class="entry-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="read more about <?php the_title_attribute(); ?>"><?php the_title(); ?></a><sup><?php comments_popup_link('0', '1', '%'); ?></sup></h2>
			
					<div class="post-meta">
					
					<span class="postdate"><?php the_time('M d, Y') ?></span>
					<span class="author">Posted by <a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>" title="<?php echo get_the_author(); ?>"><?php echo get_the_author()?></a></span>
					
					<?php if ( count( get_the_category() ) ) : ?>
					<span class="cat-links">
						<?php printf( __( '<span class="%1$s"> in</span> %2$s', 'Cindy' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
					</span>
					<span class="meta-sep">|</span>
				<?php endif; ?>
				<?php
					$tags_list = get_the_tag_list( '', ', ' );
					if ( $tags_list ):
				?>
					<span class="tag-links">
						<?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'Cindy' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
					</span>
					<span class="meta-sep">|</span>
				<?php endif; ?>
				    <span class="post-views"><?php if(function_exists('the_views')) {  the_views();  } ?></span>
					<span class="edit"><?php edit_post_link('Edit', '  ', '  '); ?></span>
					</div><!--End of post-meta-->

			
			
			        <div class="thumbnail-box">
					
					<?php include('includes/thumbnail.php'); ?>
					<span class="postdate"><?php //the_time('Y/m/d') ?></span>
					</div>
					
					<div class="entry-content">
							<?php if (has_excerpt())
						         { 
								   the_excerpt();
						         }
						         else{
							        echo mb_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 480,"...");
						
						         } 
						?>
					<div class="more"><a href="<?php the_permalink() ?>" title="read more about <?php the_title(); ?>" rel="bookmark" class="title">read more</a></div>
					


					</div><!-- .entry-content -->
					
				
					
					
					
					
					
				</div><!-- #post-## -->
            <div class="post-end"></div>
			
			<?php endwhile; // end of the loop. ?>
		
			 <?php endif; ?>
			</div><!-- #content -->
			<?php pagination($query_string); ?>


<?php //get_sidebar(); ?>
<?php get_footer(); ?>
